﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Threading.Tasks;
using System.Configuration;

namespace 摇奖器Demo
{
    class SqlHelper
    {
        public static OleDbConnection ConnAccess = new OleDbConnection();
        public static string ConnAccessStr = ConfigurationManager.ConnectionStrings["OleDB_conn"].ToString();
        /// <summary>
        /// 创建连接
        /// </summary>
        /// <returns></returns>
        public static  void OleDB_Connacte(OleDbConnection conn,string strConn)
        {
            conn.ConnectionString = strConn;
        }

        public static Boolean OleDB_State(OleDbConnection conn)
        {
            return conn.State == ConnectionState.Connecting;
        }

        public static OleDbCommand OleDB_Command(OleDbConnection conn, string sql)
        {
            OleDbCommand cmd = new OleDbCommand(sql, conn);
            return cmd;
        }

        public static Boolean OleDB_ReConnate(OleDbConnection conn)
        {
            if (conn.State == ConnectionState.Connecting)
            {
                return true;
            }
            conn.Open();
            return true;
        }
        
    }
}
